package help;

import graph.Node;

import java.util.HashSet;

import temp.Temp;
import tree.Exp;
import util.List;

public class Helper {

	public static boolean comparaHashSet(HashSet<Temp> curr, HashSet<Temp> old) {

		if (!old.containsAll(curr)) {
			return false;
		}
		return true;
	}
	
	public static List<Node> revertsList(List<Node> list) {
		List<Node> inv = null;
		for (List<Node> node = list; node != null; node = node.tail) {
			if (inv == null) {
				inv = new List<Node>(node.head, null);
			} else {
				inv.tail = new List<Node>(inv.head, inv.tail);
				inv.head = node.head;
			}
		}
		return inv;
	}
	
	public static List<Exp> revertsExpList (List<Exp> list) {
		List<Exp> inv = null;
		for (List<Exp> node = list; node != null; node = node.tail) {
			if (inv == null) {
				inv = new List<Exp>(node.head, null);
			} else {
				inv.tail = new List<Exp>(inv.head, inv.tail);
				inv.head = node.head;
			}
		}
		return inv;
	}

}
